package Test;

import static org.junit.Assert.*;

import org.junit.*;

import Spil.*;

public class TestRefuge {

	private GameFields refugeWalled;
	private GameFields refugeMonastery;
	private Player player;
	
	@Before
	public void setUp() throws Exception {
      	this.player = new Player("Anders And", 1);
      	this.refugeWalled = new FieldRefuge(5000, "Walled City", 10);
      	this.refugeMonastery = new FieldRefuge(500, "Monastery", 20);
	}

	@After
	public void tearDown() throws Exception {
      	this.player = new Player("Anders And", 1);
	}

	
	@Test
	public void testEntities() {
      	assertNotNull(this.player);
      	
      	assertNotNull(this.refugeWalled);
      	assertNotNull(this.refugeMonastery);
      	
      	assertTrue(this.refugeWalled instanceof FieldRefuge);
      	assertTrue(this.refugeMonastery instanceof FieldRefuge);
	}

	@Test
	public void testLandOnFieldWalled() {
      	int expected = 30000;
      	int actual = this.player.bank.getBalance();
      	assertEquals(expected, actual);
      	
      	//Perform the action to be tested
      	this.refugeWalled.landOnField(this.player);
      	
      	expected = 30000 + 5000;
      	actual = this.player.bank.getBalance();
      	assertEquals(expected, actual);
	}

	@Test
	public void testLandOnFieldMonastery() {
      	int expected = 30000;
      	int actual = this.player.bank.getBalance();
      	assertEquals(expected, actual);
      	
      	//Perform the action to be tested
      	this.refugeMonastery.landOnField(this.player);
      	
      	expected = 30000 + 500;
      	actual = this.player.bank.getBalance();
      	assertEquals(expected, actual);
	}

}
